const install = function (Vue) {
  const _vue = new Vue();

  Vue.prototype.$loading = {

    show(msg, callback) {

      _vue.$bus.$emit('xy_inner_bus_loading', {
        value: true,
        text: msg
      });

      const customPromise = function () {
        return new Promise(function (resolve, reject) {
          setTimeout(() => {
            resolve(callback())
          }, 2000);
        })
      };

      customPromise().then(function (data) {

      }).catch(function(error){

      });

    }

  }

};

export default install;
